package org.base.common.config;

import org.base.common.fs.FileSystem;
import org.base.common.fs.LocalFileSystem;
import org.base.common.properties.LocalFileProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author He mingliang
 */
@Configuration
@EnableConfigurationProperties(LocalFileProperties.class)
public class FSConfig {

    @Autowired
    private LocalFileProperties localFileProperties;

    @Bean
    public FileSystem fileSystem() {
        return new LocalFileSystem(localFileProperties.getStorePath(), localFileProperties.getContextPath());
    }
}
